using Cysharp.Threading.Tasks;
using System;
using UnityEngine;

namespace IQIGame.Onigao.GamePlay
{
    public class MainCityCameraCtrl : FreeViewCameraController
    {
        protected MainCityRegionCtrl regionCtrl => parent as MainCityRegionCtrl;
        public override Action<Func<UniTask>> AddPreloadAfterScene => regionCtrl.sceneCtrl.AddPreloadAfterScene;
        protected override bool isPlayerMoving => regionCtrl.gamepadCtrl.isMoving;

        protected override void OnSceneLoaded()
        {
            base.OnSceneLoaded();
            //注册手势事件处理函数（无需手动移除）
            regionCtrl.gamepadCtrl.onTouchGesture += CameraGesture;
            regionCtrl.gamepadCtrl.onTouchUp += CameraTouchUp;
            regionCtrl.gamepadCtrl.onTouchTap += CameraTouchTap;
        }

        protected override Transform GetPlayerEntityTransform()
        {
            return regionCtrl.entityCtrl.playerAvatarEntity.transform;
        }

        protected override void OnDispose()
        {
            base.OnDispose();
        }
    }
}
